﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Core.CMS;
using AjaxControlToolkit.HTMLEditor;
using System.Web.Security;

namespace cms
{
    public partial class Default : ManagedPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Page.Title = Info.Title;
                Main.Content = Info.GetContent("Main");
                Main.DataBind();
            }
        }

        protected void ui_btnEditMain_Click(object sender, EventArgs e)
        {
            Main.EnableEditing = true;
            Main.Content = Info.GetContent("Main");
            Main.DataBind();
        }

        protected void ui_btnDone_Click(object sender, EventArgs e)
        {
            Info.SetContent("Main", Main.Content);
            Main.EnableEditing = false;
            Main.DataBind();
        }

        protected void ui_btnCancel_Click(object sender, EventArgs e)
        {
            Main.EnableEditing = false;
            Main.Content = Info.GetContent("Main");
            Main.DataBind();
        }

        protected void Editor_ContentChanged(object sender, EventArgs e)
        {
            Editor target = ((Control)sender).NamingContainer as Editor;
            Main.Content = target.Content;
        }
    }
}